import { _decorator, Component, Node } from 'cc';
import { BagItem } from '../goods/goodsInfo';
import { Util } from '../core/Util';
import { EPrefabName } from '../../enum';
import { SingleGoods } from './SingleGoods';
import { Core } from '../core/Core';
const { ccclass, property } = _decorator;

@ccclass('ScrollView')
export class ScrollView extends Component {
    @property(Node) ndContent: Node = null;
    

    init(items: BagItem[]) {
        for (let i = 0; i < items.length; i++) {
            const item = items[i];
            let ndGoods = Core.instance.getNode(EPrefabName.SINGLE_GOODS, this.node);
            ndGoods.getComponent(SingleGoods).init(item);
            ndGoods.parent = this.ndContent;

        }
    }
}


